package org.dromara.system.utils;

import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum CompanyInfoFieldEnum {

    FIELD1("name","供应商名称"),
    FIELD2("unifiedSocialCreditCode","统一社会信用代码"),
    FIELD3("legalRepresentative","法定代表人"),
    FIELD4("capital","注册资金（万元）"),
    FIELD401("currency","币种"),
    FIELD5("address","注册所在地");

    private final String field;
    private final String fieldName;

    public static CompanyInfoFieldEnum findByFieldName(String fieldName) {
        if (StringUtil.isBlank(fieldName)) {
            return null;
        }
        for (CompanyInfoFieldEnum type : values()) {
            if (type.fieldName.equals(fieldName.replaceAll("\\s*|\r|\n|\t",""))) {
                return type;
            }
        }
        return null;
    }

}
